import { createI18n } from 'vue-i18n'
import type { App } from 'vue'
import zhCN from './lang/zh-CN.json'
import enUS from './lang/en-US.json'
import zhTW from './lang/zh-TW.json'

const messages = {
  'zh-CN': {
    ...zhCN
  },
  'en-US': {
    ...enUS
  },
  'zh-TW': {
    ...zhTW
  }
}

export const i18n = createI18n({
  locale: 'zh-CN',
  legacy: false,
  messages
})

export const setUpI18n = async (app: App) => {
  app.use(i18n)
}
